<%
js_configs = {
  api_path: decidim_api.root_path(locale: nil),
  icons_path: Decidim.cors_enabled ? "" : asset_pack_path("media/images/remixicon.symbol.svg"),
  messages: {
    "selfxssWarning": I18n.t("decidim.security.selfxss_warning"),
    "mentionsModal": {
      "removeRecipient": t("decidim.shared.mentions_modal.remove_recipient", name: "%name%")
    },
    "confirmUnload": t("decidim.shared.confirm_unload"),
    emojis: I18n.t("emojis").deep_transform_keys { |k| k.to_s.camelize(:lower) },
    editor: I18n.t("editor"),
    date: I18n.t("date"),
    time: I18n.t("time"),
    forms: {
      correct_errors: t("forms.correct_errors")
    },
    notifications: {
      action_error: I18n.t("decidim.notifications.action_error")
    },
    characterCounter: {
      charactersAtLeast: {
        one: t("forms.length_validator.minimum.one", count: "%count%", default: "forms.length_validator.minimum.other"),
        other: t("forms.length_validator.minimum.other", count: "%count%")
      },
      charactersLeft: {
        one: t("decidim.components.add_comment_form.remaining_characters_1", count: "%count%"),
        other: t("decidim.components.add_comment_form.remaining_characters", count: "%count%")
      }
    }
  },
  external_domain_allowlist: [current_organization.host] + current_organization.external_domain_allowlist,
  consent_cookie_name: Decidim.consent_cookie_name,
  sign_out_path: decidim.destroy_user_session_path
}
external_link_messages = {
  "externalLink": t("decidim.accessibility.external_link"),
  "opensInNewTab": t("decidim.accessibility.opens_in_new_tab")
}
%>

<script>
  Decidim.config.set(<%== js_configs.to_json %>);
  Decidim.ExternalLink.configureMessages(<%== external_link_messages.to_json %>);
</script>
